
public class TestThread extends Thread {
	private Queue queue;
	private int tid;
	private int testType;
	private int numIters;
	public long estimatedTime;
		
	TestThread(Queue queue, int tid, int testType, int numIters) {
		this.queue = queue;
		this.tid = tid;
		this.testType = testType;
		this.numIters = numIters;
	}

	public void run() {	 	
    	long startTime = System.nanoTime();
		for (int j = 0; j < numIters; j++) {
			if (testType == 0) {
				enq(j);
				deq(j);								
			} else if (testType == 1) {
			  // do here something else
			}
		}
    	estimatedTime = System.nanoTime() - startTime;
	}

	
	private void enq(int iterNum) {
		int value = tid * numIters + iterNum;
		queue.enq(tid, value);		
	}

	private void deq(int iterNum) {
		try {
			/*int i =*/ queue.deq(tid);

		} catch (Exception e) {
		  // do something
		}
		return;
	}
	
}